import {
  ArgumentMetadata,
  BadRequestException,
  HttpException,
  Injectable,
  PipeTransform,
} from '@nestjs/common';

@Injectable()
export class UserByIdPipe implements PipeTransform<number, UserEntity> {
  transform(value: number, metadata: ArgumentMetadata): UserEntity {
    if (isNaN(value)) {
      throw new BadRequestException();
    }
    return {
      id: 123,
      name: 'gorge',
      age: 25,
    };
  }
}
